<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>COSTUME-IZER</title>

<link rel="stylesheet" type="text/css" href="demo/styles.css" />

   <center>
<%@ page language="java" import="java.sql.*" %>
<h1>
    <%
    String txtuser = request.getParameter("Username");
    String txtpass = request.getParameter("Password");


    Connection con = null;
    Statement st = null;
    ResultSet rs = null;
    String url = "jdbc:mysql://localhost:3306/rbpl";
    String user = "root";
    String password = "";
    try {
        Class.forName("com.mysql.jdbc.Driver");
        con = DriverManager.getConnection(url, user, password);
        st = con.createStatement();
        rs = st.executeQuery("SELECT Username FROM userdetails where Username='" + txtuser + "' and Password=('" + txtpass + "')");
        if (rs.next()) {
            HttpSession ses = request.getSession(true);
            ses.putValue("ses_Username", txtuser);
            out.println("Login Berhasil!!");
            out.println(" Selamat Datang " + txtuser + " di Costume-izer ");
            
%>
    </center>
    </h1>
    
<body>

<div id="main">

<ul id="navigationMenu">
    <li>
	    <a class="home" href="dashboard.jsp">
            <span>Dashboard</span>
        </a>
    </li>
    
    <li>
    	<a class="about" href="logout.jsp">
            <span>Logout</span>
        </a>
    </li>
</ul>
   
</div>

<%
} else {
    out.println("Login Salah! Isikan Username dan Password dengan benar atau");
%>

<p>Belum terdaftar? Silakan mendaftar <a href="signup2.jsp">disini</a></p>
<%
        }
    } catch (Exception e) {
        out.println(e);
    }
%>
</head>
</body>
</html>

